#ifndef BASE_PLAYER_H
#define BASE_PLAYER_H

#include"./public.h"
#include"./place_base.h"
#include"../include/place.h"
#include"../include/map.h"
#include<vector>
#include<algorithm>
namespace monopoly{
class Zone;
class Player{
public:
    Player() = default;
    Player(const Player& player) = default;
    Player(PlayerName name,Place cur_place_){
        this->name = name;
        this->cur_place = &cur_place_;
    };
    ~Player() = default;

    friend class Zone;
    friend class Mine;
    friend class GiftRoom;
    friend class ToolRoom;
    friend class Hospital;
    friend class Barricade;
    friend class Prison;

    uint8_t DiceNum();
    bool ChangePosition(uint8_t position, Map& global_map);
    bool Advance(Map& global_map);
    void UpdateCurPlace(Map& global_map);
    Place* CurPlace();
    PlayerName Name(){return this->name;};
    void GetMoney(uint32_t money);
    bool LostMoney(uint32_t money);
    void GetPoint(uint32_t point);
    bool LostPoint(uint32_t point);
    void PayToOtherPlayer(uint32_t money, Player& other);
    bool InZoneVector(const Zone& zone) const;
    bool InToolVector(const Tool& tool) const;
    void GetZone(Zone& zone);
    bool LostZone(Zone& zone);
    void GetTool(Tool& tool);
    bool UseTool(Tool& tool, Zone& zone);
    void GoToHospital(Map& global_map);
    bool IsHurted(){return this->is_hurted;};
    bool CanAdvance(){return this->can_advance;};
    void MaybeTriggerEvent();
private:
    bool is_hurted=false;
    bool can_advance=true;
    PlayerName name;
    uint32_t money = 10000;
    uint32_t point = 0;
    uint8_t dice_num;
    PlayerState state = NORMAL;
    Place* cur_place;
    uint8_t rest_wealth_time = 0;
    std::vector<Zone> ZoneVector;
    std::vector<Tool> ToolVector;
};
}// namespace monopoly
#endif// BASE_PLAYER_H_